package org.finegold.core.mail.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.finegold.core.tool.utils.BeanUtil;
import org.finegold.core.mail.core.MailAccount;
import org.finegold.core.mail.props.FineMailProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 邮件发送客户端
 *
 * @author looly
 * @since 3.2.0
 */
@Data
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties(FineMailProperties.class)
public class MailConfiguration {

	private final FineMailProperties fineMailProperties;

	@Bean
	public MailAccount buildMailAccount() {
		return BeanUtil.copy(fineMailProperties, MailAccount.class);
	}
}
